========
hostmeta
========

A simple Python client implementation of `Web Host Metadata RFC 6415 <https://tools.ietf.org/html/rfc6415>`_.

Web Host Metadata is a discovery protocol that allows you to find information about endpoints on a webserver host, given that you have a hostname to look up, in a standardized way. See the `spec <https://tools.ietf.org/html/rfc6415>`_ for more information.

Basic usage::

    >>> from hostmeta import get_host_meta
    >>> hm = get_host_meta('social.umeahackerspace.se')
    >>> len(hm.link)
    6
    >>> hm.find_link('http://apinamespace.org/oauth/request_token').href
    'https://social.umeahackerspace.se/api/oauth/request_token'
    >>>
    >>> wf_url = hm.webfinger.apply_template('acct:mmn@social.umeahackerspace.se')
    >>> wf_url
    'https://social.umeahackerspace.se/.well-known/webfinger?resource=acct%3Ammn%40social.umeahackerspace.se'
    >>> import rd
    >>> wf = rd.loads(requests.get(wf_url, headers={'Content-Type': hm.webfinger.type}).text, hm.webfinger.type)
    >>> wf.find_link('describedby').href
    'https://social.umeahackerspace.se/mmn/foaf'


get_host_meta
=============

get_host_meta(host, scheme='https')
    *get_host_meta* will lookup a certain host with the optionally specific scheme. The *host* parameter is a fully qualifiable domain name. The optional *scheme* parameter lets you override the default policy of connecting using HTTPS.

Dependencies
============

* `requests <https://pypi.python.org/pypi/requests>`_


License
=======

python-hostmeta is distributed under the `BSD license <http://creativecommons.org/licenses/BSD/>`_.

See LICENSE for the full terms.
